﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:wp7cinema_ViewModel="clr-namespace:wp7cinema.ViewModel" xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls" xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    x:Class="wp7cinema.View.TheaterInfo"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">
	<phone:PhoneApplicationPage.Resources>
		<DataTemplate x:Key="DataTemplate1">
			<Grid>
				<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Title}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<DataTemplate x:Key="ListPickerFullModeTemplate">
			<StackPanel Orientation="Horizontal" Margin="16,21,0,20">
				<Rectangle Fill="#FFA8E4F3" Stroke="Black" Height="43" Width="43"/>
				<TextBlock TextWrapping="Wrap" Text="{Binding Title}" FontSize="43" Margin="16,0,0,0"/>
			</StackPanel>
		</DataTemplate>
		<DataTemplate x:Key="TheaterListTemplate">
			<Grid>
				<TextBlock TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<DataTemplate x:Key="DateListTemplate">
			<Grid>
				<TextBlock TextWrapping="Wrap" Text="{Binding Value}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<Style x:Key="TimeTemplate" TargetType="ListBoxItem">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="BorderBrush" Value="Transparent"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Top"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Disabled"/>
								</VisualStateGroup>
								<VisualStateGroup x:Name="SelectionStates">
									<VisualState x:Name="Unselected"/>
									<VisualState x:Name="Selected"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Border Margin="0,0,10,10" BorderThickness="3">
								<StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Center">
									<TextBlock TextWrapping="Wrap" Text="{Binding ViewStr}" FontSize="{TemplateBinding FontSize}" d:LayoutOverrides="Height"/>
								</StackPanel>
							</Border>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="ListBoxStyle1" TargetType="ListBox">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="BorderBrush" Value="Transparent"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBox">
						<StackPanel x:Name="ScrollViewer" Background="{TemplateBinding Background}" >
							<ItemsPresenter d:LayoutOverrides="Width"/>
						</StackPanel>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<DataTemplate x:Key="MovieListFullModeStyle">
			<StackPanel Margin="16,0,0,20" Orientation="Horizontal" Width="400">
				<Rectangle Fill="#FFA8E4F3" Stroke="Black" Height="35" Width="35" VerticalAlignment="Center"/>
				<TextBlock TextWrapping="Wrap" Text="{Binding Title}" FontSize="32" Margin="16,0,0,0" LineHeight="29.333" Width="348"/>
			</StackPanel>
		</DataTemplate>
	</phone:PhoneApplicationPage.Resources>
 
<!--Sample code showing usage of ApplicationBar-->
<!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
            <toolkit:NavigationInTransition.Backward>
            	<toolkit:SlideTransition Mode="SlideDownFadeIn" />
            </toolkit:NavigationInTransition.Backward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut" />
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideUpFadeOut" />
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
	
	<phone:PhoneApplicationPage.DataContext>
		<wp7cinema_ViewModel:TheaterInfoViewModel/>
	</phone:PhoneApplicationPage.DataContext>
<!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
        	<RowDefinition Height="Auto"/>
        	<RowDefinition Height="*"/>
        </Grid.RowDefinitions>
    	<Custom:Interaction.Triggers>
    		<Custom:EventTrigger EventName="SelectionChanged" SourceName="listPicker">
    			<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetMovieCmd" Command="{Binding SetMovieCommand}" CommandParameter="{Binding ElementName=listPicker, Mode=OneWay}"/>
    		</Custom:EventTrigger>
    		<Custom:EventTrigger EventName="SelectionChanged" SourceName="DateList">
    			<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetDateCmd" Command="{Binding SetDateCommand}" CommandParameter="{Binding ElementName=DateList, Mode=OneWay}"/>
    		</Custom:EventTrigger>
    	</Custom:Interaction.Triggers>
    	<controls:Pivot Grid.Row="1" Title="{Binding SelectedTheater.Name}" FontSize="26.667">
    		<controls:PivotItem Header="상영영화">
    			<StackPanel Orientation="Vertical" d:LayoutOverrides="Height">
    				<toolkit:ListPicker x:Name="listPicker" Margin="0" Header="상영영화" ItemsSource="{Binding Movies}" ItemTemplate="{StaticResource DataTemplate1}" FontSize="32" FullModeItemTemplate="{StaticResource MovieListFullModeStyle}" ItemCountThreshold="10"/>
    				<toolkit:ListPicker x:Name="DateList" Margin="0" Header="날 짜" ItemsSource="{Binding EnableDates}" ItemTemplate="{StaticResource DateListTemplate}" ItemCountThreshold="10" FontSize="32"/>
    				<StackPanel Margin="0,20,0,0" Orientation="Vertical" Background="#FF476078">
    					<TextBlock TextWrapping="Wrap" Text="상영시간" FontSize="26.667" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    				</StackPanel>
    				<ListBox x:Name="TimeList" Margin="0,10,0,0" IsSynchronizedWithCurrentItem="False" ItemContainerStyle="{StaticResource TimeTemplate}" ItemsSource="{Binding Tickets}" FontSize="32" Style="{StaticResource ListBoxStyle1}"/>
    			</StackPanel>
    		</controls:PivotItem>
    		<controls:PivotItem Header="극장정보">
    			<Grid>
    				<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Center" FontSize="29.333" Text="준비중입니다..."/>
    			</Grid>
    		</controls:PivotItem>
    	</controls:Pivot>
    </Grid>

</phone:PhoneApplicationPage>
